<template>
  <div>
    <div class="content">
      <div>
        <div class="newshead">
          <div class="title-head" title="详情">详情</div>
        </div>
      </div>
      <div class="newsarea">
        <div class="location">
          <div class="selectname">
            {{selectName}}
          </div>
          <div class="local">
            <span>当前位置：</span>
            <span><a href="/">首页</a></span>
            <el-divider direction="vertical"></el-divider>
            <span><a href="#">内容详情</a></span>
          </div>
        </div>
        <div class="expert-area">
          <div class="title"><span>{{deatilText.title}}</span></div>
          <div class="pagetime"><span>{{deatilText.updateTime}}</span></div>
          <div class="pageitem" v-for="(item,index) in wordText" :key="index">
            {{item}}
          </div>
          <div style="text-align: center;" v-for="(item,index) in imgList" :key="index">
            <el-image class="pageimg" fit="cover" :src="item.url"></el-image>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import DeatilContent from '@/pages/deatil/components/DeatilContent'
export default {
  name: 'Deatil',
  components: {
    DeatilContent
  },
  data () {
    return {
      name: '',
      id: '',
      selectName: '内容详情',
      pages: 1,
      deatilText: {},
      wordText: [],
      imgList: []
    }
  },
  methods: {
    getquery () {
      this.name = this.$route.query.name
      this.id = this.$route.query.id
      if (this.name === 'Case') {
        this.$axios({
          method: 'get',
          url: '/success/get?id=' + this.id
        }).then((res) => {
          this.deatilText = res.data.data
          var content = decodeURI(res.data.data.content)
          this.wordText = content.split('<span>')
          this.imgList = res.data.data.successtList
        })
      } else if (this.name === 'News') {
        this.$axios({
          method: 'get',
          url: '/news/get?id=' + this.id
        }).then((res) => {
          this.deatilText = res.data.data
          var content = decodeURI(res.data.data.content)
          this.wordText = content.split('<span>')
          this.imgList = res.data.data.successtList
        })
      } else if (this.name === 'Notice') {
        this.$axios({
          method: 'get',
          url: '/notice/get?id=' + this.id
        }).then((res) => {
          this.deatilText = res.data.data
          var content = decodeURI(res.data.data.content)
          this.wordText = content.split('<span>')
          this.imgList = res.data.data.successtList
        })
      }
    }
  },
  mounted () {
    this.getquery()
  },
  activated () {
    this.getquery()
  }
}
</script>

<style scoped>
.content {
  padding: 20px 100px;
  display: flex;
  margin-top: 60px;
  overflow: hidden;
}
.newshead {
  width: 300px;
  height: 60px;
  background: rgb(15, 66, 155);
  color: white;
  font-size: 25px;
  text-align: center;
  margin-bottom: 40px;
  overflow: hidden;
}
.newsarea {
  padding-left: 40px;
  width: 100%;
}
.location {
  height: 60px;
  display: flex;
  justify-content: space-between;
}
.selectname {
  color: #0f4a9b;
  font-size: 25px;
  height: 22px;
  margin: 20px 0;
}
.local {
  font-size: 18px;
  height: 22px;
  margin: 20px 0;
}
.title-head {
  line-height: 40px;
  margin: 10px 0;
  cursor: pointer;
}
a {
  text-decoration: none;
  color: black;
}
.expert-area {
  width: 100%;
  background: white;
  overflow: hidden;
  align-items: center;
  padding-bottom: 20px;
}
.title {
  font-size: 22px;
  line-height: 1.8;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  text-align: center;
}
.pagetime {
  font-size: 14px;
  line-height: 1.8;
  color: #999;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  text-align: center;
}
.pageitem {
  padding: 0 50px;
  white-space: normal;
  line-height: 30px;
  font-size: 18px;
  color: #555;
  text-indent: 2rem;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  margin-bottom: 8px;
}
.pageimg {
  width: 600px;
  height: 400px;
}
h1 {
  font-family: "Microsoft YaHei", Arial, sans-serif;
  margin: 10px 0 15px 0;
}
</style>
